package com.sl.plugin.step.file;

import cn.hutool.core.util.ObjectUtil;
import com.sl.core.engine.meta.ProcessCompDescriptorService;
import com.sl.core.engine.meta.impl.AbstractProcessCompDescriptor;
import com.sl.core.engine.meta.row.ProcessRowDescriptor;
import lombok.Getter;

import java.util.Map;

/**
 *
 */
@Getter
public class FileInputCompDescriptor extends AbstractProcessCompDescriptor<
        FileInputComp, FileInputCompContext> implements ProcessCompDescriptorService {


    @Override
    public void loadDescriptor(Map<String, Object> map) {

        //开始输入文件
        String filePath = getStrAttr("filePath");
        String fileType = getStrAttr("fileType");


        //标记是开始
        setIsStartStep(true);
    }


    @Override
    public ProcessRowDescriptor getResultDescriptor(ProcessRowDescriptor rowDescriptor) {
        ProcessRowDescriptor rowMeta = getInputRowDescriptor();
        if (ObjectUtil.isNull(rowMeta) || rowMeta.isEmptyAndNotBasic()) {
            return rowDescriptor;
        }
        return rowMeta;
    }

}
